package com.spudtech.collision.polygon
{
    
    import flash.geom.*;
    
    import com.spudtech.*;
    import com.spudtech.collision.*;
    
    
    public class SpudLineSegment
    {
        
        // End point 'A'
        protected var _a : Point;
        
        // End point 'B'
        protected var _b : Point;
        
        
        public function SpudLineSegment(pt_a : Point, pt_b : Point)
        {
            _a = pt_a.clone();
            _b = pt_b.clone();
            
        }
        
        
        public function get a() : Point
        {
            return _a;
        }
        public function set a(new_a : Point) : void
        {
            _a = new_a.clone();
        }
        
        public function get b() : Point
        {
            return _b;
        }
        public function set b(new_b : Point) : void
        {
            _b = new_b.clone();
        }
        
        
        
        public function get vectorAB() : Point
        {
            // Vector from A to B
            
            var vector : Point = new Point();
            
            vector.x = b.x - a.x;
            vector.y = b.y - a.y;
            
            return vector;
            
        }
        
        public function get vectorBA() : Point
        {
            // Vector from B to A
            
            var vector : Point = new Point();
            
            vector.x = a.x - b.x;
            vector.y = a.y - b.y;
            
            return vector;
            
        }
        
        
        
        public function intersects(other : SpudLineSegment) : Boolean
        {
            // TODO
            
            return false;
        }
        
        
    }
    
}
